Skip to content

Commit 8585b42

Browse files
authored
move import to avoid slow startup due to creds check (#6690)
1 parent 31906d6 commit 8585b42

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kitsune/llm/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from functools import cache
22

3-
from langchain_google_vertexai import ChatVertexAI
3+
from langchain.chat_models.base import BaseChatModel
44

55

66
@cache
@@ -9,10 +9,12 @@ def get_llm(
99
temperature: int = 1,
1010
max_tokens: int | None = None,
1111
max_retries: int = 2,
12-
) -> ChatVertexAI:
12+
) -> BaseChatModel:
1313
"""
1414
Returns a LangChain chat model instance based on the given LLM model name.
1515
"""
16+
from langchain_google_vertexai import ChatVertexAI
17+
1618
return ChatVertexAI(
1719
model=model_name, temperature=temperature, max_tokens=max_tokens, max_retries=max_retries
1820
)

0 commit comments

Comments
 (0)